<?php
	include 'open-connection.php';

	// Performing SQL query
	$query = 'SELECT * FROM puestotrabajo';
	$result = mysql_query($query) or die('Query failed: ' . mysql_error());
	
	while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
		$arr[] = $line;
	}
	$total = mysql_num_rows(mysql_query($query));

	include 'close-connection.php';
	
	echo '{total: '.$total.', results: '.json_encode($arr).'}';
?>